#include "StdAfx.h"
#include "DSEngine.h"

using namespace BAA;

DSEngine::DSEngine(void)
{
	nextIndex = 0;
}

DSEngine::~DSEngine(void)
{
}

/*
	next is responsible for determining the next agent to execute
		and the length of time that agent is allowed to run

		@return pair<Agent*, int>
						|	   |
						|	time for that agent to run
					next agent to run


*/
std::pair<Agent *, float> DSEngine::next(std::vector<Agent*> * agents, float maxTimeStep){
	//temporarily implements a fair dispatcher/scheduler
	std::pair<Agent*, float> result;
	result.first = agents->at(nextIndex);
	result.second = maxTimeStep / agents->size();

	nextIndex = (nextIndex + 1) % agents->size();

	return result;
}